package com.xg.util.export;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.HashMap;

public class SheetData<T> {
    private String sheetName; // Sheet 名称
    private List<T> dataList; // 实体数据列表
    private Class<T> entityClass; // 实体类类型（用于注册样式处理器）
    private Map<String, Object> headerData; // 其他动态填充数据（可选）
    private String head; // 表头
    //存储实体类字段（含@ColumnWidth注解）
    private List<Field> entityFields;

    public SheetData(String sheetName, List<T> dataList, Class<T> entityClass) {
        this.sheetName = sheetName;
        this.dataList = dataList;
        this.entityClass = entityClass;
        this.headerData = new HashMap<>();
    }

    public SheetData(String sheetName, List<T> dataList, Class<T> entityClass, Map<String, Object> headerData, String head, List<Field> entityFields) {
        this.sheetName = sheetName;
        this.dataList = dataList;
        this.entityClass = entityClass;
        this.headerData = headerData != null ? headerData : new HashMap<>();
        this.head = head;
        this.entityFields = entityFields;
    }

    public SheetData(String sheetName, List<T> dataList, Class<T> entityClass, Map<String, Object> headerData, String head) {
        this.sheetName = sheetName;
        this.dataList = dataList;
        this.entityClass = entityClass;
        this.headerData = headerData != null ? headerData : new HashMap<>();
        this.head = head;
    }

    // Getters and Setters
    public String getSheetName() { return sheetName; }
    public List<T> getDataList() { return dataList; }
    public Class<T> getEntityClass() { return entityClass; }
    public Map<String, Object> getHeaderData() { return headerData; }
    public String getHead() { return head; }
}
